package ccy.ccyarmourersworkshopupdateplayerskin;

import ccy.ccylibrary.plugin.CcyPlugin;
import moe.plushie.armourers_workshop.common.capability.entityskin.EntitySkinCapability;
import moe.plushie.armourers_workshop.common.capability.wardrobe.player.PlayerWardrobeCap;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.FMLCommonHandler;
import org.bukkit.entity.Player;

public class CcyArmourersWorkshopUpdatePlayerSkin extends CcyPlugin {

    public static CcyArmourersWorkshopUpdatePlayerSkin ccyPlugin;

    @Override
    public Object MainClass() {
        return this;
    }

    @Override
    public String pluginName() {
        return "时装工坊刷新玩家时装";
    }

    @Override
    public void PluginEnable() {
        ccyPlugin=this;
    }

    public void UpdatePlayerSkin(Player Bplayer){
        EntityPlayerMP player = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerByUUID(Bplayer.getUniqueId());
        Entity commandSenderEntity = player.getCommandSenderEntity();
        if(commandSenderEntity!=null){
            EntitySkinCapability.get(commandSenderEntity).syncToPlayer(player);
            PlayerWardrobeCap.get(player).syncToPlayer(player);
        }
    }
}
